<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<!--<script src="./promise-构造函数.js"></script>-->
<script src="./Promise-类.js"></script>
<script>
  const p1 = new PromiseClass((resolve,reject) => {
    setTimeout(() => {
      reject(1)
    },4000)
  })
  
  // const p1 = PromiseClass.resolve(1)
  const p2 = PromiseClass.rejectDelay(2, 4000)
  const p3 = PromiseClass.resolve(3)
  
  p2.then(value => {
    console.log('resolveDelay resolve ', value)
  }, reason => {
    console.log('rejectDelay reject ', reason)
  })
  
  // const pRace = PromiseClass.race([p1,p2,p3])
  // pRace.then(value => {
  //   console.log('pRace resolve ', value)
  // }, reason => {
  //   console.log('pRace reject ', reason)
  // })
  //

  // const pAll = PromiseClass.all([p1,p2,p3])
  // pAll.then(value => {
  //   console.log('pAll resolve ', value)
  // }, reason => {
  //   console.log('pAll reject ', reason)
  // })

  
  // p1.then(
  //   value => {
  //     console.log('then resolve ', value)
  //     return p2
  //   },
  //   reason => {console.log('then reject ', reason)}
  // )
  //   .catch(reason => {
  //     console.log('catch p2 ', reason)
  //     return p3
  //   })
  //   .catch(reason => {
  //     console.log('catch p3 ', reason)
  //   })
  

 

</script>
</body>
</html>
